module.exports = () => {
  return async function request(ctx, next) {
    await next();
    const body = ctx.body;
    if (!body) return;
    console.log('body');
    console.log(body);
    if (body.err_msg) {
      const errMsg = body.err_msg;
      delete body.err_msg;
      ctx.body = { data: body, status: ctx.response.status, message: errMsg };
    } else {
      ctx.body = { data: body, status: ctx.response.status, message: ctx.response.message };
    }
  };
};
